#ifndef __MYTHREAD_H__
#define __MYTHREAD_H__
#include<stdio.h>


#define debug




#define STACK_SIZE 1024 /*//Define max size of thread_stack*/
#define THR_TASKS 32    /*//Define max size of thread*/

#define THREAD_STATUS_RUNNING 0//Status:运行
/*#define THREAD_STATUS_SLEEP 1  //Status:sleep*/
/*#define THREAD_STATUS_READY 2  //Status:ready*/
#define THREAD_STATUS_EXIT 3   /*Status:退出*/

struct TCB
{
    int id; /*//thread_id*/
    void (*thread_func)();/*//The function for thread processing*/
    int esp; /*// esp(Top of running stack)*/
    int status; /*// The status of running*/
    int stack[STACK_SIZE];/*//栈1024个元素*/
};
typedef struct TCB* PtrTCB;


/*//创建线程*/
int thread_create(int* tid, void (*start_routine)());

void start(PtrTCB TSK);

/*//切换调度*/
int MyYield();

void Mythreadfree(int pid);





#endif //__MYTHREAD_H__
